<!-- 运费方式 -->
<template>
  <div class="payment">
     <van-field
      readonly
      clickable
      label="运费方式"
      :value="defaultpay"
      placeholder="选择运费方式"
      @click="showPicker = true"
    />
    <van-popup v-model="showPicker" position="bottom">
      <van-picker
        show-toolbar
        :columns="elbG"
        @confirm="onConfirm "
        @cancel="showPicker = false"
      />
    </van-popup>
  </div>
</template>

<script>
export default {
  name: "payment",
  data() {
    return {
      showPicker:false,
      elbG: [ "现付","到付"],
      defaultpay:'现付',
      active:0
    };
  },
  methods: {
     onConfirm(value, index) {
      console.log("确认选择该地址",value,index);
      this.active = index
      console.log(this.active)
      this.defaultpay = value;
      this.showPicker = false;
      this.$emit("Paymentmethod",this.active)
      
    },
  },
  created() {
    this.$emit("Paymentmethod",this.active)
  },
};
</script>
<style lang='scss' scoped>
</style>